<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div id="main" style="width:800px;height: 350px;"></div>
</body>
</html>
<script src="${pageContext.request.contextPath}/Resource/js/jquery-3.3.1.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/Resource/echarts/echarts.common.min.js"></script>
<link href="${pageContext.request.contextPath}/image/logo.png" rel="Shortcut Icon">
<script>
    var chartDom = document.getElementById('main');
    var myChart = echarts.init(chartDom);
    var option;

    var myClient;
    var myRedeemRecord;
    $.ajax({
        url : "/Anonymous/selectClientOne.do",//请求地址
        dataType : "json",//数据格式
        type : "post",//请求方式
        async : false,//是否异步请求
        data:{},
        success : function(data) {   //成功返回数据
            myClient=data;
        }
    });

    $.ajax({
        url : "/Anonymous/selectRedeemRecord.do",//请求地址
        dataType : "json",//数据格式
        type : "post",//请求方式
        async : false,//是否异步请求
        data:{},
        success : function(data) {   //成功返回数据
            myRedeemRecord=data;
        }
    });

    option = {
        title: {
            text: '注册客户总数和营业额',
            left: 'center'
        },
        tooltip: {
            trigger: 'item'
        },
        legend: {
            orient: 'vertical',
            left: 'left',
        },
        series: [
            {
                name: '访问来源',
                type: 'pie',
                radius: '50%',
                data:[
                    {value: myClient, name: '注册客户总数'},
                    {value: myRedeemRecord, name: '营业额'}
                ],
                emphasis: {
                    itemStyle: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };
    option && myChart.setOption(option);
</script>
